import axios from "axios"
const baseUrl = "/myshopping/"  //  代理路径
function ajax_get(path,params={}){
    return axios.get(baseUrl + path,{params})
}

// 请求一级分类列表
let getTypeOnelist = ()=>ajax_get("getTypeOne")

// 请求轮播图数据
let getBanner = ()=>ajax_get("banner")

// 首页所有商品
let getGoodList = params => ajax_get("goodList", params);

// 登录
let getLogin = params => ajax_get("login", params);

// 注册
let getRegister = params => ajax_get("register", params)

// 搜索
let getSearch = params => ajax_get("search", params)

// 获取商品详情
var getDetail = params => ajax_get("detail", params)

// 同店相似商品推荐
var getSameGoods = params => ajax_get("sameList", params)

// 获取购物车数据
var getCartList = params => ajax_get("shopList", params)

// 购物车商品数量增加/添加购物车
var getCartAdd = params => ajax_get("add", params)

// 购物车商品数量减小
var getCartRemove = params => ajax_get("remove", params)

// 删除购物车商品
var getCartDelete = params => ajax_get("del", params)


// 导出所有请求的函数
export{
    getTypeOnelist,
    getBanner,
    getGoodList,
    getLogin,
    getRegister,
    getSearch,
    getDetail,
    getSameGoods,
    getCartList,
    getCartAdd,
    getCartRemove,
    getCartDelete,
}